<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
namespace Agp\CoreBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Sylius\Bundle\CartBundle\Entity\CartItem as BaseCartItem;
use Sylius\Bundle\CartBundle\Model\CartItemInterface;
use APY\DataGridBundle\Grid\Mapping as GRID;
use Agp\CoreBundle\Entity\ListaPreco;

/**
 * Agp\CoreBundle\Entity\PedidoSiteItem
 *
 * @ORM\Table(name="pedido_site_item")
 * @ORM\Entity(repositoryClass="Agp\CoreBundle\Repository\PedidoSiteItemRepository")
 */
class PedidoSiteItem
{
    /**
     * @var integer $codPedidoItem
     *
     * @ORM\Column(name="cod_pedido_site_item", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    protected $codPedidoItem;
    
    /**
     * @var object $produto
     * 
     * @ORM\ManyToOne(targetEntity="Agp\CoreBundle\Entity\Produto", fetch="LAZY")
     * @ORM\JoinColumn(name="cod_produto", referencedColumnName="cod_produto", onDelete="Restrict", nullable=false)
     * 
     * @GRID\Column(field="produto.nome", title="Produto", type="text")
     * @GRID\Column(field="produto.qtdeAtual", title="Quantidade", type="text", align="center")
     */
    protected $produto;
    
    /**
     * @var object $empresa
     *
     * @ORM\ManyToOne(targetEntity="Agp\CoreBundle\Entity\Empresa", fetch="LAZY")
     * @ORM\JoinColumn(name="cod_empresa", referencedColumnName="cod_empresa", onDelete="Restrict", nullable=false)
     */
    protected $empresa;
    
    /**
     * @var object $listaPreco
     * 
     * @ORM\ManyToOne(targetEntity="Agp\CoreBundle\Entity\ListaPreco", fetch="LAZY")
     * @ORM\JoinColumn(name="cod_lista_preco", referencedColumnName="cod_lista_preco", onDelete="Restrict", nullable=false)
     * 
     * @GRID\Column(field="listaPreco.nome", title="Lista", type="text")
     */
    protected $listaPreco;
    
    /**
     * @var object $evento
     *
     * @ORM\ManyToOne(targetEntity="Agp\CoreBundle\Entity\Evento", fetch="LAZY")
     * @ORM\JoinColumn(name="cod_evento", referencedColumnName="cod_evento", nullable=true, onDelete="Restrict", nullable=true)
     */
    protected $evento;
    
    /**
     * @var object $evento
     *
     * @ORM\ManyToOne(targetEntity="PedidoSite", fetch="LAZY", inversedBy="item", cascade={"persist"})
     * @ORM\JoinColumn(name="cod_pedido_site", referencedColumnName="cod_pedido_site", nullable=true, onDelete="Cascade", nullable=true)
     */
    protected $pedidoSite;
    
    /**
     * @ORM\Column(name="qtd_item", type="integer", nullable=false)
     */
    protected $qtdItem;
    
    /**
     * @ORM\Column(name="vlr_item", type="float", nullable=false)
     */
    protected $vlrItem;
    
    /**
     * @ORM\Column(name="vlr_item_no_taxa", type="float", nullable=false)
     */
    protected $vlrItemNoTaxa;
    
    /**
     * @ORM\Column(name="subtotal", type="float", nullable=false)
     */
    protected $subtotal;
    
    /**
     * @ORM\Column(name="retirado", type="boolean", nullable=false)
     */
    protected $retirado;
    
    /**
     * @ORM\Column(name="nm_ticket", type="integer", nullable=true)
     */
    protected $nmTicket;
    
    public function __construct() {
        $this->retirado = false;
    }

    public function getSubtotalNoTaxa(){
        return $this->vlrItemNoTaxa * $this->qtdItem;
    }

    public function getId() {
        return $this->id;
    }

    public function getCodPedidoItem() {
        return $this->codPedidoItem;
    }

    public function setCodPedidoItem($codPedidoItem) {
        $this->codPedidoItem = $codPedidoItem;
    }

    public function getProduto() {
        return $this->produto;
    }

    public function setProduto($produto) {
        $this->produto = $produto;
    }

    public function getEmpresa() {
        return $this->empresa;
    }

    public function setEmpresa($empresa) {
        $this->empresa = $empresa;
    }

    public function getListaPreco() {
        return $this->listaPreco;
    }

    public function setListaPreco($listaPreco) {
        $this->listaPreco = $listaPreco;
    }

    public function getEvento() {
        return $this->evento;
    }

    public function setEvento($evento) {
        $this->evento = $evento;
    }

    public function getPedidoSite() {
        return $this->pedidoSite;
    }

    public function setPedidoSite($pedidoSite) {
        $this->pedidoSite = $pedidoSite;
    }

    public function getQtdItem() {
        return $this->qtdItem;
    }

    public function setQtdItem($qtdItem) {
        $this->qtdItem = $qtdItem;
    }

    public function getVlrItem() {
        return $this->vlrItem;
    }

    public function setVlrItem($vlrItem) {
        $this->vlrItem = $vlrItem;
    }

    public function getSubtotal() {
        return $this->subtotal;
    }

    public function setSubtotal($subtotal) {
        $this->subtotal = $subtotal;
    }
    
    public function getVlrItemNoTaxa() {
        return $this->vlrItemNoTaxa;
    }

    public function setVlrItemNoTaxa($vlrItemNoTaxa) {
        $this->vlrItemNoTaxa = $vlrItemNoTaxa;
    }
    
    public function getRetirado() {
        return $this->retirado;
    }

    public function setRetirado($retirado) {
        $this->retirado = $retirado;
    }

    public function getNmTicket() {
        return $this->nmTicket;
    }

    public function setNmTicket($nmTicket) {
        $this->nmTicket = $nmTicket;
    }

}

?>
